﻿using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;

namespace Solver
{
	public class Problem001 : SelfChecker, IProblem
	{
		public int Id
		{
			get { return 1; }
		}
		
		public string Solve()
		{
			return SolveInternal().ToString();
		}

		private static long SolveInternal()
		{
			return MultiplesOf(3, 333).Union(MultiplesOf(5, 199)).Sum();
		}

		[Test]
		public override void Check()
		{
			Assert.AreEqual(23, MultiplesOf(3, 3).Union(MultiplesOf(5, 1)).Sum());
			Assert.AreEqual(233168, SolveInternal());
		}

		private static IEnumerable<int> MultiplesOf(int seed, int count)
		{
			return Enumerable.Range(1, count).Select(i => i * seed);
		}
	}
}
